home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
flyout
/
module1.bas
< prev
next >
Wrap
BASIC Source File
|
1995-05-09
|
22KB
|
561 lines
Option Explicit
'*************************************************************************
'* *
'* GLOBAL CONSTANTS *
'* *
'*************************************************************************
'
' GetSystemMetrics() codes
'
Global Const SM_CXSCREEN = 0
Global Const SM_CYSCREEN = 1
Global Const SM_CXVSCROLL = 2
Global Const SM_CYHSCROLL = 3
Global Const SM_CYCAPTION = 4
Global Const SM_CXBORDER = 5
Global Const SM_CYBORDER = 6
Global Const SM_CXDLGFRAME = 7
Global Const SM_CYDLGFRAME = 8
Global Const SM_CYVTHUMB = 9
Global Const SM_CXHTHUMB = 10
Global Const SM_CXICON = 11
Global Const SM_CYICON = 12
Global Const SM_CXCURSOR = 13
Global Const SM_CYCURSOR = 14
Global Const SM_CYMENU = 15
Global Const SM_CXFULLSCREEN = 16
Global Const SM_CYFULLSCREEN = 17
Global Const SM_CYKANJIWINDOW = 18
Global Const SM_MOUSEPRESENT = 19
Global Const SM_CYVSCROLL = 20
Global Const SM_CXHSCROLL = 21
Global Const SM_DEBUG = 22
Global Const SM_SWAPBUTTON = 23
Global Const SM_RESERVED1 = 24
Global Const SM_RESERVED2 = 25
Global Const SM_RESERVED3 = 26
Global Const SM_RESERVED4 = 27
Global Const SM_CXMIN = 28
Global Const SM_CYMIN = 29
Global Const SM_CXSIZE = 30
Global Const SM_CYSIZE = 31
Global Const SM_CXFRAME = 32
Global Const SM_CYFRAME = 33
Global Const SM_CXMINTRACK = 34
Global Const SM_CYMINTRACK = 35
Global Const SM_CMETRICS = 36
'
' API message constants.
'
Global Const WM_MOVE = &H3
Global Const WM_MOUSEFIRST = &H200
Global Const WM_MOUSEMOVE = &H200
Global Const WM_LBUTTONDOWN = &H201
Global Const WM_LBUTTONUP = &H202
Global Const WM_LBUTTONDBLCLK = &H203
Global Const WM_RBUTTONDOWN = &H204
Global Const WM_RBUTTONUP = &H205
Global Const WM_RBUTTONDBLCLK = &H206
Global Const WM_MBUTTONDOWN = &H207
Global Const WM_MBUTTONUP = &H208
Global Const WM_MBUTTONDBLCLK = &H209
Global Const WM_MOUSELAST = &H209
' Key State Masks for Mouse Messages
Global Const MK_LBUTTON = &H1
Global Const MK_RBUTTON = &H2
Global Const MK_SHIFT = &H4
Global Const MK_CONTROL = &H8
Global Const MK_MBUTTON = &H10
'
' My constants
'
Global Const MODELESS = 0 ' Show forms as modeless.
Global Const MODAL = 1 ' Show forms as modal.
Global Const LEFT_BUTTON = 1 ' VB's code for left mouse button in MouseDown event.
Global Const RIGHT_BUTTON = 2 ' VB's code for right mouse button in MouseDown event.
Global Const MAX_TOOLBOX_ITEMS = 16 ' Maximum number of items allowed in a toolbox.
Global Const MAX_FLYOUT_ITEMS = 16 ' Maximum number of items allowed in a flyout.
Global Const WM_USER = &H400 ' Used in PostMessage() call from flyout to toolbox.
Global Const ICON_ARC = 0 ' Indexes into PictureClip control bitmap for all
Global Const ICON_BOLD = 5 ' icons. Bitmap is 5 columns by 20 rows. The
Global Const ICON_BUTTON = 10 ' first column contains the normal version of
Global Const ICON_CAMERA = 15 ' each icon. The second column contains the
Global Const ICON_CENTERJUST = 20 ' depressed version of the icon. Columns 3-5
Global Const ICON_DOUBLEUNDERLINE = 25 ' are not used.
Global Const ICON_HELP = 30
Global Const ICON_ITALIC = 35
Global Const ICON_FULLJUST = 40
Global Const ICON_LEFTJUST = 45
Global Const ICON_LINE = 50
Global Const ICON_MACRO = 55
Global Const ICON_OVAL = 60
Global Const ICON_PRINTER = 65
Global Const ICON_RECTANGLE = 70
Global Const ICON_SMALLCAPS = 75
Global Const ICON_SUMMATION = 80
Global Const ICON_CENTERTAB = 85
Global Const ICON_DECIMALTAB = 90
Global Const ICON_LEFTTAB = 95
Global Const ICON_DEPRESSED = 1 ' Add this to the base index of an icon to get the
' PictureClip control index for the depressed icon.
'*************************************************************************
'* *
'* DATA STRUCTURE DEFINITIONS *
'* *
'*************************************************************************
Type POINTAPI
X As Integer
Y As Integer
End Type
Type tagIcons
icon_index As Integer ' Index of icon im PictureClip control
help_str As String ' Help string for this icon
End Type
Type tagFlyoutData
num_icons As Integer
num_columns As Integer
num_rows As Integer
End Type
Type tagToolBox
title As String ' Caption for toolbox window
num_items As Integer ' Number of icons in this toolbox (must be 1..16)
num_columns As Integer ' Number of column in this toolbox (must defined)
num_rows As Integer ' Number of rows in toolbox (is calculated)
tool_selected As Integer ' Index in icons() of selected tool.
icons(0 To 15, 0 To 16) As tagIcons ' Contains description for all icons in a toolbox
' as well as the flyout associated with each tool.
' icons(x,0) is description for toolbox tool icon X
' icons(x,y) is decsription for icon Y on the
' flyout menu displayed when tool X is selected.
flyout_data(0 To 15) As tagFlyoutData
' Contains data for every flyout. The number_icons
' and num_columns fields must be set. The num_rows
' field is calulated. Each element corresponds to
' the flyout for the toolbox icon with the same
' index. the field number_icons must be in the
' range 1..16. The field num_columns must be
' defined; num_rows is calculated.
flyout_item_selected As Integer ' Index in icons() for the flyout menu icon selected
' (e.g., icons(tool_selected,flyout_item_selected))
End Type
'*************************************************************************
'* *
'* GLOBAL VARIABLES *
'* *
'*************************************************************************
Global gToolbox As tagToolBox ' The definition for our toolbox.
'*************************************************************************
'* *
'* API AND DLL ROUTINE DECLARATIONS *
'* *
'*************************************************************************
Declare Function GetSystemMetrics% Lib "User" (ByVal nIndex%)
Declare Sub dwDWORDto2Integers Lib "dwspydll.dll" (ByVal l&, X%, Y%)
Declare Sub MoveWindow Lib "User" (ByVal hWnd%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal bRepaint%)
Declare Function SetCapture% Lib "User" (ByVal hWnd%)
Declare Sub ReleaseCapture Lib "User" ()
Declare Function PostMessage% Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, ByVal lParam&)
Sub ArrangeFlyout ()
Dim border_width% ' Width of the flyout window border
Dim